import {Injectable} from "@angular/core";
import {API} from "../constants/constants";
import {RequestUtil} from "../util/request-util";
import {MsgResult} from "../models/msg-result";
import {Observable} from "rxjs/Observable";

@Injectable()
export class OnlineService {

  constructor(
    private requestUtil:RequestUtil
  ) {  }

  /**
   * 获取在线账户名
   * @returns {Observable<MsgResult>|any}
   */
  getAccountName():Observable<MsgResult>{
    return this.requestUtil.get(API.getOnlineAccountName);
  }

  /**
   * 获取在线账户的门户路径
   * @returns {Observable<MsgResult>|any}
   */
  getOnlinePortal():Observable<MsgResult>{
    return this.requestUtil.get(API.getOnlinePortal);
  }

  /**
   * 获取当前在线账户的主题
   * @returns {Observable<MsgResult>|any}
   */
  getOnlineTheme():Observable<MsgResult>{
    return this.requestUtil.get(API.getOnlineTheme);
  }

  /**
   * 当前是否在线
   * @returns {Observable<MsgResult>|any}
   */
  isOnline():Observable<MsgResult>{
    return this.requestUtil.get(API.isOnline);
  }
}
